﻿<phone:PhoneApplicationPage xmlns:my="clr-namespace:MP3tunes.LockerPlayer.UserControls"  
    x:Class="MP3tunes.LockerPlayer.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource BaseForeground}" 
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="{StaticResource DefaultBackground}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
            <!--Panorama control-->
        <controls:Pivot  Name="pivotControl" Grid.Row="0">
            <controls:Pivot.Title>

                <StackPanel Orientation="Horizontal">
                    <Image Source="/MP3tunes.LockerPlayer;component/Images/MP3tunes2.png" Width="120" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
                    <TextBlock Text="Locker Player" FontSize="45" Foreground="{StaticResource BaseForeground}" />
                </StackPanel>


            </controls:Pivot.Title>
            <!--Pivot item one-->
            <controls:PivotItem Name="artists" Style="{StaticResource pivotItemStyle}">
                <controls:PivotItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Artists" FontStyle="Italic" FontSize="40" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>
                    </StackPanel>
                </controls:PivotItem.Header>
          
              
                <Grid>
                    <ListBox Margin="0,0,-12,0" ItemsSource="{Binding}" Name="artistList" SelectionChanged="artistList_SelectionChanged">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17" Width="432">


                                    <TextBlock Text="{Binding ArtistName}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="{StaticResource BaseForeground}"/>
                                    <TextBlock Text="{Binding DisplayMessage1}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}" Foreground="{StaticResource BaseForegroundAccent}"/>
                                    <TextBlock Text="{Binding DisplayMessage2}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}" Foreground="{StaticResource BaseForegroundAccent}"/>

                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem  Name="albums">
                <controls:PivotItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Albums" FontStyle="Italic" FontSize="40" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>
                    </StackPanel>
                </controls:PivotItem.Header>
                <Grid>
                    <ListBox Margin="0,0,-12,0" ItemsSource="{Binding}"  x:Name="listAlbums" SelectionChanged="listAlbums_SelectionChanged" Grid.Row="0">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" Margin="0,0,0,17">
                                    <!--Replace rectangle with image-->
                                    <Image Height="150" Width="150" Margin="12,0,9,0" Source="{Binding Path=AlbumArtUrl}" Stretch="Uniform">
                                        <Image.Clip>
                                            <RectangleGeometry RadiusX="12" RadiusY="12" Rect="0,0,150,150" />
                                        </Image.Clip>
                                    </Image>
                                    
                                    <StackPanel Width="311">
                                        <TextBlock Text="{Binding AlbumTitle}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="{StaticResource BaseForeground}"/>
                                        <TextBlock Text="{Binding ArtistName}" TextWrapping="Wrap"  Style="{StaticResource PhoneTextSubtleStyle}"   Foreground="{StaticResource BaseForeground}"/>
                                    </StackPanel>
                                </StackPanel>


                            </DataTemplate>

                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Name="playlists">
                <controls:PivotItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Playlists" FontStyle="Italic" FontSize="40" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>
                    </StackPanel>
                </controls:PivotItem.Header>
                <Grid>
                    <ListBox Margin="0,0,-12,0" ItemsSource="{Binding}" Name="playlistList" SelectionChanged="playlistList_SelectionChanged" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17" Width="432">


                                    <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="{StaticResource BaseForeground}"/>
                     
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Name="videos" Visibility="Collapsed">
                <controls:PivotItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Videos" FontStyle="Italic" FontSize="40" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>
                    </StackPanel>
                </controls:PivotItem.Header>
                <Grid>
                    <ListBox Margin="0,0,-12,0" ItemsSource="{Binding}" Name="videoList" SelectionChanged="videoList_SelectionChanged" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17" Width="432">


                                    <TextBlock Text="{Binding TrackTitle}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="{StaticResource BaseForeground}"/>

                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem  Name="menu">
                <controls:PivotItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Menu" FontStyle="Italic" FontSize="40" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}"/>
                    </StackPanel>
                </controls:PivotItem.Header>
                <Grid>
                    <my:AppMenu x:Name="appMenu" OnNavigate="appMenu_OnNavigate" />
                </Grid>
            </controls:PivotItem>
         

        </controls:Pivot>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250"></ColumnDefinition>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Name="statusMessage" Grid.Column="0" Foreground="{StaticResource BaseForeground}"/>
            <ProgressBar Grid.Column="1" Style="{StaticResource PerformanceProgressBar}" Name="statusProgress" IsIndeterminate="True"/>
        </Grid>
        <my:Credentials Grid.RowSpan="2" Visibility="Collapsed" x:Name="credControl" />
    </Grid>
 
    <!--Panorama-based applications should not show an ApplicationBar-->

</phone:PhoneApplicationPage>